/* eslint-disable no-unused-vars */
import {reqAddressInfo, reqOrderInfo} from '@/api'
const state = {
  address: [],
  orderList: {}
}

const mutations = {
  GETUSERADDRESS(state, address) {
    state.address = address
  },
  GETORDERINFO(state, orderList) {
    state.orderList = orderList
  }
}

const actions = {
  // 获取用户信息
  async getUserAddress({commit}){
    let result = await reqAddressInfo();
    if (result.code == 200) {
      commit('GETUSERADDRESS', result.data);
    }
  },
  // 获取订单商品列表
  async getOrderInfo({commit}){
    let result = await reqOrderInfo();
    if (result.code == 200) {
      commit('GETORDERINFO', result.data);
    }
  }
}

const getters = {

}

export default ({
  state,
  mutations,
  actions,
  getters
})